<template>
	<view class="team">
		<uv-navbar placeholder autoBack bgColor="#CA1C1D">
			<template v-slot:left>
				<view class="left_slot">
					<image src="@/static/images/back.png"></image>
				</view>
			</template>
			<template v-slot:center>
				<view class="nav_title">我的团队</view>
			</template>
		</uv-navbar>
		<view class="header">
			<view class="item" :class="active==1?'active':''" @click="change(1)">我的团队</view>
			<view class="item" :class="active==2?'active':''" @click="change(2)">我的收益</view>
		</view>
		<component :is="currentComponent" />
	</view>
</template>

<script setup>
	import MyTeam from "@/components/my/MyTeam.vue";
	import MyIncome from "@/components/my/MyIncome.vue";
	import {
		ref,
		shallowRef
	} from "vue";
	const currentComponent = shallowRef(MyTeam);
	const active = ref(1);
	const change = (value) => {
		active.value = value;
		if (value == 1) {
			currentComponent.value = MyTeam;
		}
		if (value == 2) {
			currentComponent.value = MyIncome;
		}
	};
</script>

<style scoped lang="scss">
	.team {
		height: calc(100vh - var(--window-top) - var(--window-bottom));
		padding: 0rpx 25rpx;
		box-sizing: border-box;
		background-color: #f5f5f5;
		overflow: hidden;

		.left_slot {
			image {
				width: 43rpx;
				height: 36rpx;
			}
		}

		.nav_title {
			color: #F5F5F5;
			font-size: 36rpx;
		}

		.header {
			height: 100rpx;
			border-radius: 20rpx;
			margin-top: 20rpx;
			padding: 0 20rpx;
			box-sizing: border-box;
			background: #EEEEEE;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.item {
				width: 308rpx;
				height: 68rpx;
				line-height: 68rpx;
				text-align: center;
				color: #666666;
				font-size: 28rpx;
				border-radius: 10rpx;

				&.active {
					color: #FFFFFF;
					background: #CA1C1D;
				}
			}
		}
	}
</style>